package com.example.spring.Service;

import com.example.spring.Dto.*;
import com.example.spring.mapper.ProductDetails2021Mapper;
import com.example.spring.mapper.ProductDetailsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductDetailsService {

    @Autowired
    private ProductDetailsMapper productDetailsMapper;


    //21年到25年各个省份的总订单数
    public List<ProvinceOrderCountDTO> getOrderCountByProvince() {
        return productDetailsMapper.countOrdersByProvince();
    }

    // 获取每个省份前十的客户数量
    public List<ProvinceTopCustomerDTO> getTopCustomersByProvince() {
        return productDetailsMapper.getTopCustomersByProvince();
    }

    // 统计每个省份的客户数量
    public List<ProvinceCustomerCountDTO> countCustomersByProvince() {
        return productDetailsMapper.countCustomersByProvince();
    }

    // 获取客户数量前10的省份
    public List<ProvinceCustomerCountDTO> getTop10ProvincesByCustomerCount() {
        return productDetailsMapper.getTop10ProvincesByCustomerCount();
    }

    // 统计每个省份的客户数量（从sales_records表）
    public List<ProvinceCustomerCountDTO> countCustomersByProvinceFromSalesRecords() {
        return productDetailsMapper.countCustomersByProvinceFromSalesRecords();
    }

    // 获取客户数量前10的省份（从sales_records表）
    public List<ProvinceCustomerCountDTO> getTop10ProvincesByCustomerCountFromSalesRecords() {
        return productDetailsMapper.getTop10ProvincesByCustomerCountFromSalesRecords();
    }


    //21-25年客户购买总订单数量
    public List<YearlyOrderCountDTO> getOrderCountByYear() {
        return productDetailsMapper.countOrdersByYear();
    }


    //统计数据总量
    public OrderCountDTO getTotalOrderCount() {
        return productDetailsMapper.getTotalOrderCount();
    }

    //21-25各个区域的客户订单数
    public List<RegionOrderCountDTO> getRegionOrderCounts() {
        return productDetailsMapper.getRegionOrderCounts();
    }

    public List<RegionOrderCount> getRegionOrderCount() {
        return productDetailsMapper.getRegionOrderCount();
    }


}
